# Name: [Verify Blogs Page Links]
# By: [Wyatt Preul]
# [A simple test case for verifying all of the links and their values on the blogs page]
# Maintenance:
#   [9/2//2006] : [WLP] : Created
#

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'watir'
include Watir
require 'test/unit'
require '../watir.config.rb'

#_replace_Template_with_the_short_name_of_your_test_case
class TC_BlogsPage_test < Test::Unit::TestCase
      
      def startup			
        @@ie = Watir::IE.start($SITE_URL + 'blogs/default.aspx')
      end
    
      def ie
        if defined? @@ie
          @@ie
        else
          startup
        end
      end
      
      def test_01_testLinksExist
        assert(ie.link(:text, 'Help').exists?)
        #assert(ie.link(:id, /TitleBarSearchButton$/).exists?)
        assert(ie.link(:text, 'Home').exists?)
        assert(ie.link(:text, 'Blogs').exists?)
        assert(ie.link(:text, 'Forums').exists?)
        assert(ie.link(:text, 'Photos').exists?)
        assert(ie.link(:text, 'Downloads').exists?)
        assert(ie.button(:id, /SearchButton$/).exists?)
        assert(ie.link(:text, 'experience').exists?)
        #assert(ie.link(:text, 'Welcome to Community Server Blogs!').exists?)
        assert(ie.link(:text, 'Blogging').exists?)
        assert(ie.link(:text, 'Browse All Tags').exists?)
        assert(ie.link(:text, 'RSS Syndication').exists?)
        assert(ie.link(:text, 'Opml').exists?)
        assert(ie.link(:text, 'Blogs on this Site').exists?)
      end
      
      def test_02_testLinksCorrect
        assert_equal 'http://communityserver.org/r.ashx?K', ie.link(:text, 'Help').href
        assert_equal $SITE_URL, ie.link(:text, 'Home').href
        assert_equal $SITE_URL + 'blogs/', ie.link(:text, 'Blogs').href
        assert_equal $SITE_URL + 'forums/', ie.link(:text, 'Forums').href
        assert_equal $SITE_URL + 'photos/', ie.link(:text, 'Photos').href
        assert_equal $SITE_URL + 'files/', ie.link(:text, 'Downloads').href
        assert_equal $SITE_URL + 'tags/default.aspx', ie.link(:text, 'Browse All Tags').href
        assert_equal $SITE_URL + 'blogs/MainFeed.aspx', ie.link(:text, 'RSS Syndication').href
        assert_equal $SITE_URL + 'blogs/Opml.aspx', ie.link(:text, 'Opml').href
        assert_equal $SITE_URL + 'blogs/Bloggers.aspx', ie.link(:text, 'Blogs on this Site').href
      end
      
      def test_99_closeIE
        ie.close
      end
end